package com.zlx.mall.basic.util;

import cn.hutool.core.lang.Snowflake;

import java.util.UUID;

/**
 * taotao
 *
 * @description 序列化工具
 */
public class SerialUtil {


    /**
     * 还款流水编号 repay-serial-id
     */
    public static final String REPAY_SERIAL_PREFIX = "RS";

    /**
     * 还款计划编号
     */
    public static final String REPAY_PLAN_PREFIX = "PL";

    /**
     * 提现流水号
     */
    public static final String WITHDRAWAL_NO_PREFIX = "WD";

    /**
     * 还款页面流水号
     */
    public static final String REPAY_PAGE_PREFIX = "RP";

    public static Snowflake snowflake = new Snowflake();

    public static String uuid() {
        UUID uuid = UUID.randomUUID();
        return uuid.toString().replace("-","");
    }

    public static Long snowflakeId() {
        return snowflake.nextId();
    }

    public static String snowflakeIdStr() {
        return snowflake.nextIdStr();
    }

    public static String repaySerialId() {
        return REPAY_SERIAL_PREFIX + snowflakeIdStr();
    }

    public static String repayPlanId() {
        return REPAY_PLAN_PREFIX + snowflakeIdStr();
    }

    public static String withdrawalNo() {
        return WITHDRAWAL_NO_PREFIX + snowflakeIdStr();
    }

    public static String repayPageNo() {
        return REPAY_PAGE_PREFIX + snowflakeIdStr();
    }
}
